package com.example.securitydemo1.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * ClassName: TestController
 * Package: com.example.securitydemo1.controller
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-05-29
 * Time: 11:45
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/add")
    public String add(){
        return "hello";
    }


    @GetMapping("/index")
    public String index(){
        return "hello index";
    }

    //添加注解
    @GetMapping("/update")
    @Secured({"ROLE_sale","ROLE_manager"})
    public String update(){
        return "注解,角色访问";
    }

}
